<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/cr/ui.html">
<link rel="import" href="chrome://resources/html/cr/ui/command.html">
<link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html">
<link rel="import" href="chrome://downloads/browser_proxy.html">
<link rel="import" href="chrome://downloads/constants.html">
<link rel="import" href="chrome://downloads/i18n_setup.html">
<link rel="import" href="chrome://downloads/item.html">
<link rel="import" href="chrome://downloads/search_service.html">
<link rel="import" href="chrome://downloads/toolbar.html">

<dom-module id="downloads-manager">
  <template>
    <style include="cr-hidden-style">
      :host {
        display: flex;
        flex: 1 0;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
        z-index: 0;
      }

      @media screen and (max-width: 1024px) {
        :host {
          flex-basis: calc(
              var(--downloads-card-width) + 2 * var(--downloads-card-margin));
        }
      }

      #toolbar {
        position: relative;
        z-index: 1;
      }

      #drop-shadow {
        @apply --cr-container-shadow;
      }

      :host([has-shadow_]) #drop-shadow {
        opacity: var(--cr-container-shadow-max-opacity);
      }

      #downloads-list {
        /* TODO(dbeam): we're not setting scrollTarget explicitly, yet
         * style="overflow: auto" is still being set by <iron-list>'s JS. Weird.
         */
        overflow-y: overlay !important;
      }

      #no-downloads,
      #downloads-list {
        flex: 1;
      }

      :host([loading]) #no-downloads,
      :host([loading]) #downloads-list {
        display: none;
      }

      #no-downloads {
        align-items: center;
        color: #6e6e6e;
        display: flex;
        font-size: 123.1%;
        font-weight: 500;
        justify-content: center;
        /* To avoid overlapping with the header, we need this min-height
         * until bug 596743 is fixed. */
        min-height: min-content;
      }

      #no-downloads .illustration {
        background: -webkit-image-set(
            url(chrome://downloads/1x/no_downloads.png) 1x,
            url(chrome://downloads/2x/no_downloads.png) 2x)
            no-repeat center center;
        height: 144px;  /* Matches natural image height. */
        margin-bottom: 32px;
      }

      #output video {
        width: 100%;
      }
      #progressBar {
          height: 5px;
          width: 0%;
          background-color: #35b44f;
          transition: width .4s ease-in-out;
      }
      body.is-seed .show-seed {
          display: inline;
      }
      body.is-seed .show-leech {
          display: none;
      }
      .show-seed {
          display: none;
      }
      #status code {
          font-size: 90%;
          font-weight: 700;
          margin-left: 3px;
          margin-right: 3px;
          border-bottom: 1px dashed rgba(255,255,255,0.3);
      }

      .is-seed #hero {
          background-color: #154820;
          transition: .5s .5s background-color ease-in-out;
      }
      #hero {
          background-color: #2a3749;
      }
      #status {
          color: #fff;
          font-size: 17px;
          padding: 5px;
      }
      a:link, a:visited {
          color: #30a247;
          text-decoration: none;
      }
      #torrentId {
          width:80%
      }
    </style>

    <downloads-toolbar id="toolbar" spinner-active="{{spinnerActive_}}"
        role="none">
    </downloads-toolbar>
    <div>
      <span>
        <!-- 下载的BT类型集合 -->
        <template is="dom-repeat" items="[[downloadBTUrls]]" >
            <label>
                <!-- 每条item数据 :checked勾选 点击 -->
                <input type="checkbox"  on-click="onCheckedDownloadType" checked >{{item.typeName}}
            </label>
        </template>                    
    </span>  

    </div>
    
    <div id="drop-shadow"></div>
    <iron-list id="downloads-list" items="[[items_]]"
        hidden="[[!hasDownloads_]]">
      <template>
        <downloads-item data="[[item]]"></downloads-item>
      </template>
      
    </iron-list>
    <div id="no-downloads" hidden="[[hasDownloads_]]">
      <div>
        <div class="illustration"></div>
        <span>[[noDownloadsText_(inSearchMode_)]]</span>
      </div>
    </div>
  </template>
  <script src="chrome://downloads/moment.min.js"></script>
  <script src="chrome://downloads/webtorrent.min.js"></script>
  <script src="chrome://downloads/manager.js"></script>
  
  <script>

    
  </script>
</dom-module>
